<?php /*a:3:{s:70:"G:\vue\bs_orderapp_zhangYY\shop\application\admin\view\food\index.html";i:1692172049;s:73:"G:\vue\bs_orderapp_zhangYY\shop\application\admin\view\common\layout.html";i:1692172049;s:72:"G:\vue\bs_orderapp_zhangYY\shop\application\admin\view\common\alert.html";i:1692172049;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="/static/twitter-bootstrap/3.4.0/css/bootstrap.min.css" />
  <link href="/static/font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/static/css/css-main.css" />
  <script src="/static/jquery/1.12.4/jquery.min.js"></script>
  <script src="/static/twitter-bootstrap/3.4.0/js/bootstrap.min.js"></script>
  <script src="/static/js/common.js"></script>
  <title>管理中心 - 点餐系统</title>
</head>
<body>
  <nav class="navbar navbar-default navbar-static-top main-nav" role="navigation">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <div class="navbar-brand">点餐系统</div>
    </div>
    <ul class="nav navbar-right hidden-xs">
      <li><a href="<?php echo url('Index/password'); ?>"><i class="fa fa-user fa-fw"></i><?php echo htmlentities($_admin['username']); ?></a></li>
      <li><a href="logout"><i class="fa fa-power-off fa-fw"></i>退出</a></li>
    </ul>
    <div class="collapse navbar-collapse navbar-default main-sidebar">
      <ul class="nav">
        <li><a href="<?php echo url('Index/index'); ?>" class="<?php if($_path==='Index/index'): ?>active<?php endif; ?>"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li><a href="<?php echo url('Order/index', ['is_pay' => 1, 'is_taken' => 0, '_menu' => 1]); ?>" class="<?php if($_path==='Order/index' && isset($_GET['_menu'])): ?>active<?php endif; ?>"><i class="fa fa-flag fa-fw"></i>待发货</a></li>
        <li><a href="<?php echo url('Food/edit'); ?>" class="<?php if($_path==='Food/edit'): ?>active<?php endif; ?>"><i class="fa fa-edit fa-fw"></i>编辑商品</a></li>
        <li><a href="<?php echo url('Food/index'); ?>" class="<?php if($_path==='Food/index'): ?>active<?php endif; ?>"><i class="fa fa-list-alt fa-fw"></i>管理商品</a></li>
        <li><a href="<?php echo url('Category/index'); ?>" class="<?php if($_path==='Category/index'): ?>active<?php endif; ?>"><i class="fa fa-list fa-fw"></i>分类</a></li>
        <li><a href="<?php echo url('Order/index'); ?>" class="<?php if($_path==='Order/index' && !isset($_GET['_menu'])): ?>active<?php endif; ?>"><i class="fa fa-tasks fa-fw"></i>订单</a></li>
        <li><a href="<?php echo url('User/index'); ?>" class="<?php if($_path==='User/index'): ?>active<?php endif; ?>"><i class="fa fa-comments fa-fw"></i>客户</a></li>
        <li><a href="<?php echo url('Index/setting'); ?>" class="<?php if($_path==='Index/setting'): ?>active<?php endif; ?>"><i class="fa fa-cog fa-fw"></i>设置</a></li>
        <li class="visible-xs"><a href="#"><i class="fa fa-user fa-fw"></i><?php echo htmlentities($_admin['username']); ?></a></li>
        <li class="visible-xs"><a href="logout"><i class="fa fa-power-off fa-fw"></i>退出</a></li>
      </ul>
    </div>
  </nav>
  <div class="main-content">
<div class="main-food">
  <?php if(isset($info)): ?><div class="alert alert-info alert-dismissible fade in" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><?php echo htmlentities($info); ?></div><?php endif; if(isset($success)): ?><div class="alert alert-success alert-dismissible fade in" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><?php echo htmlentities($success); ?></div><?php endif; if(isset($error)): ?><div class="alert alert-danger alert-dismissible fade in" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><?php echo htmlentities($error); ?></div><?php endif; ?>
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="<?php if(!$param['recycle']): ?>active<?php endif; ?>"><a href="<?php echo url('', ['recycle' => 0]); ?>">商品管理</a></li>
    <li role="presentation" class="<?php if($param['recycle']): ?>active<?php endif; ?>"><a href="<?php echo url('', ['recycle' => 1]); ?>">回收站</a></li>
  </ul>
  <div class="main-section">
    <div class="pull-left form-inline">
      <select id="btn_category" style="width:120px;" class="form-control">
        <option value="<?php echo url('', array_merge($param, ['category_id' => 0, 'page' => 1])); ?>">所有分类</option>
        <?php foreach($category as $v): ?>
        <option value="<?php echo url('', array_merge($param, ['category_id' => $v['id'], 'page' => 1])); ?>" <?php if($param['category_id'] === $v['id']): ?>selected<?php endif; ?>><?php echo htmlentities($v['name']); ?></option>
        <?php endforeach; ?>
      </select>
      <form action="" class="input-group" style="width:200px;margin:0 10px;">
        <input type="text" class="form-control" name="search" value="<?php echo htmlentities($param['search']); ?>" placeholder="输入商品名">
        <span class="input-group-btn">
          <input type="hidden" name="category_id" value="<?php echo htmlentities($param['category_id']); ?>">
          <input type="hidden" name="recycle" value="<?php echo htmlentities($param['recycle']); ?>">
          <input type="submit" class="btn btn-default" value="搜索">
        </span>
      </form>
      <?php if($param['search'] !== ''): ?><a href="<?php echo url(); ?>">清除条件</a></span><?php endif; ?>
    </div>
  </div>
  <div class="main-section">
    <table class="table table-striped table-bordered table-hover">
      <thead>
        <tr>
          <th>标题</th>
          <th width="146">分类</th>
          <th width="130">创建时间</th>
          <th width="130">更新时间</th>
          <th width="50">状态</th>
          <th width="100">操作</th>
        </tr>
      </thead>
      <tbody>
        <?php foreach($food as $v): ?>
        <tr>
          <td><a href="<?php echo url('Food/edit', ['id' => $v['id']]); ?>"><?php echo htmlentities($v['name']); ?></a></td>
          <td><a href="<?php echo url('', array_merge($param, ['category_id' => $v['category_id'], 'page' => 1])); ?>"><?php echo !empty($v['category']['name']) ? htmlentities($v['category']['name']) : '未分类'; ?></a></td>
          <td><small><?php echo htmlentities($v['create_time']); ?></small></td>
          <td><small><?php echo htmlentities($v['update_time']); ?></small></td>
          <td><?php switch($v['status']): case "0": ?>下架<?php break; case "1": ?>上架<?php break; case "2": ?>删除<?php break; ?><?php endswitch; ?></td>
          <td><a href="<?php echo url('Food/edit', ['id' => $v['id']]); ?>" style="margin-right:7px;">编辑</a><a href="<?php echo url('', $param); ?>" style="color:#C13932" href="#" class="js-del" data-id="<?php echo htmlentities($v['id']); ?>">删除</a></td>
        </tr>
        <?php endforeach; if($food->isEmpty()): ?>
        <tr><td colspan="6" class="text-center">列表为空</td></tr>
        <?php endif; ?>
      </tbody>
    </table>
  </div>
  <div class="main-section">
    <?php echo $food; ?>
  </div>
</div>
<script>
  $('#btn_category').change(function() {
    location.href = $(this).val();
  });
  $('.js-del').click(function() {
    var id = $(this).attr('data-id');
    var url = $(this).attr('href');
    if (confirm('您确定要删除此商品？')) {
      Common.form(url, {id: id, action: 'del'}).append('<?php echo token(); ?>').submit();
    }
    return false;
  });
</script></div>
</body>
</html>